﻿#ifndef SQLMANAGEMENT_H
#define SQLMANAGEMENT_H
#include <QVector>
#include <QSqlQuery>
#include "PublicData.h"

class SQLManagement
{
public:
    static SQLManagement* Instance() //获取单例指针
    {
        if(!m_pSqlmgt)
        {
            m_pSqlmgt=new SQLManagement();
        }
        return m_pSqlmgt;
    }

    //提供对外接口
    int CreatTable(); //创建表格
    int InsertICDData(ICD_INFO icdInfo); //插入数据
    QVector<ICD_INFO> QueryAllICDInfoData(); //查询所有icd信息
    ICD_INFO QueryOneICDInfoData(int icdID);  //查询某一条icd信息
    int DeleteICDInfoData(int icdID); //删除icd信息

private:
    //提供一个private构造函数（防止外部调用构造类的实例）
    SQLManagement();
    ~SQLManagement();
    QSqlQuery str_query;

    static SQLManagement* m_pSqlmgt; //静态指针
    static QSqlDatabase m_database;
};

#endif // SQLMANAGEMENT_H
